function getCookie(key) {
	let str = document.cookie;
	let arr = str.split("; "); //分号后的空格不要删 cookie之间的键值对是通过分号+空格
	for (let i = 0; i < arr.length; i++) {
		let item = arr[i].split("=");
		if (item[0] == key) {
			return item[1];
		}
	}
	//没cookie，或者有cookie,但是没找到key 得不到cookie, 返回一个空字符串
	return "";
}
//封装一个设置cookie值得方法
function setCookieTime(key, value, day) {
	let d = new Date();
	d.setDate(d.getDate() + day);
	document.cookie = key + "=" + value + ";expires=" + d ; "path=/";
}
// 会话级别
function setCookie(key, value) {
	document.cookie = key + "=" + value ;
	
}
//删除cookie
function delCookie(key) {
	setCookie(key, " ", -1);
}
